package servlet;

import domain.ClickTrend;
import domain.ConvertRate;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ConvertRateServlet")
public class ConvertRateServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1.v->c:从页面读取参数，利用req对象
        //1.v->c:从页面读取参数，利用req对象
        ConvertRate convertRate = new ConvertRate();

        String taskid = req.getParameter("taskid");

        convertRate.setTaskid(taskid);

        req.getSession().setAttribute("convertrate",convertRate);


        System.out.println("convertrate is ok");

        resp.setContentType("application/json;charset=utf-8");

        resp.sendRedirect("05.html");
    }
}
